package cn.my.android_demo.api;

import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.HTTP;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;

public interface ApiDemo {

    @HTTP(method = "POST", path = "get", hasBody = true)
    Call<ResponseBody> http(@Query("username") String userName, @Query("password") String pwd);

    @POST("post")
    @FormUrlEncoded
    Call<ResponseBody> post(@Field("username") String userName, @Field("password") String pwd);

    @POST("post")
    @FormUrlEncoded
    Call<ResponseBody> postBody(@Body ResponseBody body);


    @POST("/get/{id}")
    @FormUrlEncoded
    Call<ResponseBody> postInPath(@Path("id") String body, @Header("os")String os);

    @Headers({"os:1","",""})
    @POST("/get/{id}")
    @FormUrlEncoded
    Call<ResponseBody> postHeaders(@Path("id") String body, @Header("os")String os);


}
